﻿//JumbotCms_4.1 Final
using System;
using System.Web;
using System.Data;
using Jumbot.Common;
using JumbotCms.Common;
namespace JumbotCms.WebFile.Writer
{
    public partial class _mine_ajax : JumbotCms.API.UserCenter
    {
        private string _operType = string.Empty;
        private string _response = string.Empty;

        protected void Page_Load(object sender, EventArgs e)

        {
            if (!CheckFormUrl())
            {
                Response.Write("提交有误");
                Response.End();
            }

            this._operType = q("oper");
            switch (this._operType)
            {
                case "ajaxDel":
                    ajaxDel();
                    break;
                case "disclaim":
                    ajaxDisclaim();
                    break;
                default:
                    DefaultResponse();
                    break;
            }
            Response.Write(this._response);
        }
        private void DefaultResponse()
        {
            User_Load("", "json");
        }
        private void ajaxDel()
        {
            User_Load("", "json");
            string sId = f("id");
            doh.Reset();
            doh.ConditionExpress = "id=@id and Islocked=0 and state<3 and userid=" + UserId;
            doh.AddConditionParameter("@id", sId);
            if (doh.Delete("jcms_module_version_source") == 1)
                this._response = JsonResult(1, "成功删除");
            else
                this._response = JsonResult(0, "删除有误");
        }
        private void ajaxDisclaim()
        {
            User_Load("", "json");
            string sId = f("id");
            doh.Reset();
            doh.ConditionExpress = "id=@id and Islocked=1 and state=1 and userid=" + UserId;
            doh.AddConditionParameter("@id", sId);
            doh.AddFieldItem("State", 0);
            doh.AddFieldItem("UserId", 0);
            if (doh.Update("jcms_module_version_source") == 1)
                this._response = JsonResult(1, "成功弃权");
            else
                this._response = JsonResult(0, "弃权有误");
        }
    }
}
